package com.m2bshop.shop.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.m2bshop.shop.pojo.BMCgoods;
import com.m2bshop.shop.pojo.good_imgs;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;
@Mapper
public interface BMCgoodsDao extends BaseMapper<BMCgoods> {
    //商品主要信息管理
    @Select("select * from BMCgoods")
    public List<BMCgoods> GetGoodsList();
    @Select("select * from BMCgoods where id = #{id}")
    public BMCgoods GetGoodsById(@Param(value = "id") int id);
    @Insert("insert into BMCgoods (name,model,brandid,price,dlperiod,weight,stock,description) values(#{name},#{model},#{brandid},#{price},#{dlperiod},#{weight},#{stock},#{description})")
    @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
    public int AddGoods(BMCgoods goods);
    @Update("update BMCgoods set name=#{name},model=#{model},price=#{price},dlperiod=#{dlperiod},weight=#{weight},stock=#{stock},description=#{description} where id=#{id}")
    public int updateGoods(BMCgoods goods);
    @Delete("delete from BMCgoods where id=#{id}")
    public int deleteGoods(int id);

    //商品种类管理
    //public List<List>


}
